<template>
    <view class="content">
        <view v-if="isShow">
            <view class="imgbg"
						@click="gotosUrls(list)"
                :style="{ backgroundImage: list.data.length>0&&list.data[0].url? 'url(' + list.data[0].url + ')':'none', backgroundColor: list.bgcolor, height: list.height + 'px', 'justify-content': list.place == 1 ? 'flex-start' : list.place == 3 ? 'flex-end' : 'center' }">
                <view :style="{ color: list.titlecolor, 'font-weight': list.radio == 1 ? 'bold' : '400' }">
                    {{ list.title }}
                </view>
            </view>
        </view>
			
    </view>
</template>

<script>
export default {
    name: "propagate",
    props: {
        type: {
            type: [String, Number],
            default: 1
        },
        obj: {
            type: Object,
            default: () => { }
        },

    },
    data() {
        return {
						list:{},
						isShow:false,
        }
    },
    computed: {


    },
    mounted() {
			this.list = this.obj
			this.isShow = true
    },
		methods:{
			gotosUrls(obj) {
				console.log(obj,"obj")
				if (obj.link == '') {
					// #ifndef  MP-WEIXIN 
					uni.showToast({
						icon: 'none',
						title: '暂未开放'
					})
					return false;
					//  #endif 
				}
				var Tab = Tab = ['pages/index/index', '/pages/cat/cat', '/pages/personal/index', '/pages/goods/category']
				if (Tab.indexOf(obj.link) != -1) {
					uni.switchTab({
						url: obj.link
					})
					return
				}
				//暂时对外部链接不考虑
				//  else if (obj.link.indexOf("www") >= 0 || obj.link.indexOf("http") >= 0 || obj.link.indexOf("https") >= 0) {
				// 	uni.navigateTo({
				// 		url: `/pages/company/skip?url=${url}`             
				// 	})
				// }
				else {
					if (obj.goodsType == 0) {
						uni.navigateTo({
							url: obj.link
						})
					} else if (obj.goodsType == 1) {
						uni.navigateTo({
							url: `/pages/commodity/details?id=${obj.link}`
						})
					} else if (obj.goodsType == 2) {
						uni.navigateTo({
							url: `/pages/commodity/seckill/seckillDetails?id=${obj.link}`
						})
					} else if (obj.goodsType == 3) {
						uni.navigateTo({
							url: `/pages/commodity/bargaining/groupBulist?id=${obj.link}`
						})
					} else if (obj.goodsType == 4) {
						uni.navigateTo({
							url: `/pages/commodity/bargaining/bargainingdetails?id=${obj.link}`
						})
					}
				}
			},
		}
}
</script>

<style lang="scss" scoped>
.image-null {
    background: #ffffff;
    height: 200px;
    font-size: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #c1c1c1;
    width: 100%;
}

.content {
    padding: 10px;

    .imgbg {
        background-repeat: no-repeat;
        background-size: 100% 100%;
        height: 300px;
        display: flex;
        align-items: center;
        padding: 10px;
    }
}
</style>
